<!DOCTYPE html>
<html>
<head>
	<title>添加店铺</title>
	<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
	<div class="layui-form" id="addStore" style="padding: 30px;">
		<form id="addShop">
			<div class="">
				<h2 class="" style="text-align: center; font-size: 20px; font-weight: bold; padding-bottom: 20px;"> 添加店铺 </h2>
				<div class="layui-form-item">
					<label class="layui-form-label">店铺名称</label>
					<div class="layui-input-block">
				      	<input type="text" name="shop_name" required  lay-verify="required" placeholder="请输入店铺名" autocomplete="off" class="layui-input">
				    </div>
				</div>
				<div class="" style="display: flex; justify-content: flex-end;">
					<button id="" type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="parent.layer.closeAll()" style=""> 取消</button>
					<button id="" type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit lay-filter="addShop" style=""> 确定</button>
				</div>
			</div>
		</form>
	</div>
	<script src="/cdn/jquery.js"></script>
	<script src="/layui/layui.js"></script>
  	<script src="/js/ajax.js"></script>
	<script type="text/javascript">
		// 弹窗
		layui.use('layer', function(){
			var layer = layui.layer;
		});
		// 表单
		layui.use('form', function(){
			var form = layui.form;

		  //监听提交
		  form.on('submit(addShop)', function(data){
		  	console.log(data);
		  	if(data.shop_name == '') return;
		  	var formData = $('#addShop').serialize();
		  	myAjaxPost(false, true, 'add_shop.html', formData, function (resp) {
		        console.log(resp);
		        if (resp.status == 'success') {
		          	tusi(resp.msg);
		          	parent.location.reload();
		        }else{
		           	// alert(resp.msg);
		          	tusi("添加失败");
		        }
      		});
		  });
		}); 
	</script>
</body>
</html>